using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._ImageAnalystTools._DeepLearning
{
    /// <summary>
    /// <para>Classify Objects Using Deep Learning</para>
    /// <para>Runs a trained deep learning model on an input raster and an optional feature class to produce a feature class or table in which each input object or feature has an assigned class or category label.</para>
    /// <para>在输入栅格和可选要素类上运行经过训练的深度学习模型，以生成要素类或表，其中每个输入对象或要素都具有分配的类或类别标注。</para>
    /// </summary>    
    [DisplayName("Classify Objects Using Deep Learning")]
    public class ClassifyObjectsUsingDeepLearning : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public ClassifyObjectsUsingDeepLearning()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_raster">
        /// <para>Input Raster</para>
        /// <para>The input image used to detect objects. The input can be a single raster or multiple rasters in a mosaic dataset, image service, or folder of images. A feature class with image attachments is also supported.</para>
        /// <para>用于检测对象的输入图像。输入可以是镶嵌数据集、影像服务或影像文件夹中的单个栅格或多个栅格。还支持带有影像附件的要素类。</para>
        /// </param>
        /// <param name="_out_feature_class">
        /// <para>Output Classified Objects Feature Class</para>
        /// <para>The output feature class that will contain geometries surrounding the objects or feature from the input feature class, as well as a field to store the categorization label.</para>
        /// <para>输出要素类，其中包含输入要素类中的对象或要素周围的几何，以及用于存储分类标注的字段。</para>
        /// </param>
        /// <param name="_in_model_definition">
        /// <para>Model Definition</para>
        /// <para><xdoc>
        ///   <para>The Esri model definition parameter value can be an Esri model definition JSON file (.emd), a JSON string, or a deep learning model package (.dlpk). A JSON string is useful when this tool is used on the server so you can paste the JSON string rather than upload the .emd file. The .dlpk file must be stored locally.</para>
        ///   <para>It contains the path to the deep learning binary model file, the path to the Python raster function to be used, and other parameters such as preferred tile size or padding.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>Esri 模型定义参数值可以是 Esri 模型定义 JSON 文件 （.emd）、JSON 字符串或深度学习模型包 （.dlpk）。在服务器上使用此工具时，JSON 字符串非常有用，因此您可以粘贴 JSON 字符串，而不是上传 .emd 文件。.dlpk 文件必须存储在本地。</para>
        ///   <para>它包含深度学习二进制模型文件的路径、要使用的 Python 栅格函数的路径以及其他参数，例如首选切片大小或填充。</para>
        /// </xdoc></para>
        /// </param>
        public ClassifyObjectsUsingDeepLearning(object _in_raster, object _out_feature_class, object _in_model_definition)
        {
            this._in_raster = _in_raster;
            this._out_feature_class = _out_feature_class;
            this._in_model_definition = _in_model_definition;
        }
        public override string ToolboxName => "Image Analyst Tools";

        public override string ToolName => "Classify Objects Using Deep Learning";

        public override string CallName => "ia.ClassifyObjectsUsingDeepLearning";

        public override List<string> AcceptEnvironments => ["cellSize", "extent", "geographicTransformations", "gpuID", "outputCoordinateSystem", "parallelProcessingFactor", "processorType"];

        public override object[] ParameterInfo => [_in_raster, _out_feature_class, _in_model_definition, _in_features, _class_label_field, _processing_mode.GetGPValue(), _model_arguments];

        /// <summary>
        /// <para>Input Raster</para>
        /// <para>The input image used to detect objects. The input can be a single raster or multiple rasters in a mosaic dataset, image service, or folder of images. A feature class with image attachments is also supported.</para>
        /// <para>用于检测对象的输入图像。输入可以是镶嵌数据集、影像服务或影像文件夹中的单个栅格或多个栅格。还支持带有影像附件的要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_raster { get; set; }


        /// <summary>
        /// <para>Output Classified Objects Feature Class</para>
        /// <para>The output feature class that will contain geometries surrounding the objects or feature from the input feature class, as well as a field to store the categorization label.</para>
        /// <para>输出要素类，其中包含输入要素类中的对象或要素周围的几何，以及用于存储分类标注的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Classified Objects Feature Class")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_feature_class { get; set; }


        /// <summary>
        /// <para>Model Definition</para>
        /// <para><xdoc>
        ///   <para>The Esri model definition parameter value can be an Esri model definition JSON file (.emd), a JSON string, or a deep learning model package (.dlpk). A JSON string is useful when this tool is used on the server so you can paste the JSON string rather than upload the .emd file. The .dlpk file must be stored locally.</para>
        ///   <para>It contains the path to the deep learning binary model file, the path to the Python raster function to be used, and other parameters such as preferred tile size or padding.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>Esri 模型定义参数值可以是 Esri 模型定义 JSON 文件 （.emd）、JSON 字符串或深度学习模型包 （.dlpk）。在服务器上使用此工具时，JSON 字符串非常有用，因此您可以粘贴 JSON 字符串，而不是上传 .emd 文件。.dlpk 文件必须存储在本地。</para>
        ///   <para>它包含深度学习二进制模型文件的路径、要使用的 Python 栅格函数的路径以及其他参数，例如首选切片大小或填充。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Model Definition")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_model_definition { get; set; }


        /// <summary>
        /// <para>Input Features</para>
        /// <para><xdoc>
        ///   <para>The point, line, or polygon input feature class that identifies the location of each object or feature to be classified and labelled. Each row in the input feature class represents a single object or feature.</para>
        ///   <para>If no input feature class is specified, the tool assumes that each input image contains a single object to be classified. If the input image or images use a spatial reference, the output from the tool is a feature class, in which the extent of each image is used as the bounding geometry for each labelled feature class. If the input image or images are not spatially referenced, the output from the tool is a table containing the image ID values and the class labels for each image.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>点、线或面输入要素类，用于标识要分类和标注的每个对象或要素的位置。输入要素类中的每一行都表示一个对象或要素。</para>
        ///   <para>如果未指定输入要素类，则该工具假定每个输入影像都包含要分类的单个对象。如果输入影像使用空间参考，则工具的输出为要素类，其中每个影像的范围将用作每个标注要素类的边界几何。如果未在空间上引用一个或多个输入图像，则工具的输出将是一个包含图像 ID 值和每个图像的类标签的表。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Features")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _in_features { get; set; } = null;


        /// <summary>
        /// <para>Class Label Field</para>
        /// <para><xdoc>
        ///   <para>The name of the field that will contain the class or category label in the output feature class.</para>
        ///   <para>If no field name is specified, a new field called ClassLabel will be generated in the output feature class.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将在输出要素类中包含类或类别标注的字段的名称。</para>
        ///   <para>如果未指定字段名称，则将在输出要素类中生成一个名为 ClassLabel 的新字段。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Class Label Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _class_label_field { get; set; } = null;


        /// <summary>
        /// <para>Processing Mode</para>
        /// <para><xdoc>
        ///   <para>Specifies how all raster items in a mosaic dataset or an image service will be processed. This parameter is applied when the input raster is a mosaic dataset or an image service.</para>
        ///   <bulletList>
        ///     <bullet_item>Process as mosaicked image—All raster items in the mosaic dataset or image service will be mosaicked together and processed. This is the default.</bullet_item><para/>
        ///     <bullet_item>Process all raster items separately—All raster items in the mosaic dataset or image service will be processed as separate images.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定如何处理镶嵌数据集或影像服务中的所有栅格项目。当输入栅格为镶嵌数据集或影像服务时，将应用此参数。</para>
        ///   <bulletList>
        ///     <bullet_item>处理为镶嵌影像 - 镶嵌数据集或影像服务中的所有栅格项目都将一起镶嵌并进行处理。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>单独处理所有栅格项目 - 镶嵌数据集或影像服务中的所有栅格项目都将作为单独的影像进行处理。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Processing Mode")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _processing_mode_value _processing_mode { get; set; } = _processing_mode_value._PROCESS_AS_MOSAICKED_IMAGE;

        public enum _processing_mode_value
        {
            /// <summary>
            /// <para>Process as mosaicked image</para>
            /// <para>Process as mosaicked image—All raster items in the mosaic dataset or image service will be mosaicked together and processed. This is the default.</para>
            /// <para>处理为镶嵌影像 - 镶嵌数据集或影像服务中的所有栅格项目都将一起镶嵌并进行处理。这是默认设置。</para>
            /// </summary>
            [Description("Process as mosaicked image")]
            [GPEnumValue("PROCESS_AS_MOSAICKED_IMAGE")]
            _PROCESS_AS_MOSAICKED_IMAGE,

            /// <summary>
            /// <para>Process all raster items separately</para>
            /// <para>Process all raster items separately—All raster items in the mosaic dataset or image service will be processed as separate images.</para>
            /// <para>单独处理所有栅格项目 - 镶嵌数据集或影像服务中的所有栅格项目都将作为单独的影像进行处理。</para>
            /// </summary>
            [Description("Process all raster items separately")]
            [GPEnumValue("PROCESS_ITEMS_SEPARATELY")]
            _PROCESS_ITEMS_SEPARATELY,

        }

        /// <summary>
        /// <para>Model Arguments</para>
        /// <para>The function arguments defined in the Python raster function class. This is where additional deep learning parameters and arguments for experiments and refinement are listed, such as a confidence threshold for adjusting the sensitivity. The names of the arguments are populated from the Python module.</para>
        /// <para>Python 栅格函数类中定义的函数参数。在这里列出了额外的深度学习参数以及实验和改进的参数，例如用于调整灵敏度的置信阈值。参数的名称是从 Python 模块填充的。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Model Arguments")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _model_arguments { get; set; } = null;


        public ClassifyObjectsUsingDeepLearning SetEnv(object cellSize = null, object extent = null, object geographicTransformations = null, object outputCoordinateSystem = null, object parallelProcessingFactor = null)
        {
            base.SetEnv(cellSize: cellSize, extent: extent, geographicTransformations: geographicTransformations, outputCoordinateSystem: outputCoordinateSystem, parallelProcessingFactor: parallelProcessingFactor);
            return this;
        }

    }

}